package main.java.com.introduce.extract;

import main.java.com.introduce.annotation.ExtractAfter;

import java.util.Date;

@ExtractAfter
public class DateRange {

    public DateRange(Date start, Date end) {
        this.start = start;
        this.end = end;
    }

    private final Date start;

    private final Date end;

    public Date getStart() {
        return start;
    }

    public Date getEnd() {
        return end;
    }

    /**
     * 选定条件式中的代码，实施Extract Method 和Move Method
     * @param arg
     * @return
     */
    boolean includes(Date arg) {
        return (arg.equals(start) ||
                arg.equals(end) ||
                (arg.after(start) && arg.before(end)));
    }
}
